<?
	include '../model/database.php';
	include '../model/xl_binh_luan_dia_diem.php';
	include '../model/xl_nguoi_dung.php';
	
	$xl_binh_luan = new xl_binh_luan_dia_diem();
	$xl_nguoi_dung = new xl_nguoi_dung();
	
	$ndung = $_REQUEST['text'];
	$manguoidung = $_REQUEST['usid'];
	$madiadiem = $_REQUEST['idp'];
	

	
	$xl_binh_luan->themBinhLuanDiaDiem($madiadiem,$manguoidung,$ndung);
	
	$arrBinhLuan = $xl_binh_luan->dsBinhLuan($madiadiem);
	$tongbinhluan = $xl_binh_luan->tong_binh_luan($madiadiem);
?>
<? 
	foreach($arrBinhLuan as $row){
		$nguoidung = $xl_nguoi_dung->layNguoiDung($row['MaNguoiDung']);
		$row1 = $nguoidung[0]; 
?>
<div id="residentsVoice"><!--một bình luận-->
								<div class="set fontFacebook composer clearfix mainCommentForm" style=" border-color: #E9E9E9; background-color: transparent; border-width: 0 0 0;">
                                	
									<div class="pic">
										<img width="50" height="50" src="uploads/user/<? if($row1['HinhAnhDaiDien']==""){ ?>anonymous.png<? }else{ echo $row1['HinhAnhDaiDien']; } ?>" /> 
									</div>
									<span>
									<a style="cursor:pointer;"><b><?=$row1['TenHienThi']?></b></a>&nbsp;&nbsp;<?=date('H:i:s d/m/Y',strtotime($row['ThoiGianBinhLuan']))?>
									</span>
									<p  style="box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 3px 3px 3px 3px;-moz-border-radius: 3px 3px 3px 3px; border-radius: 3px 3px 3px 3px; border:solid 1px #CCC; padding-left:10px; padding-bottom: 10px; padding-top: 10px">  
									<?=$row['NoiDung']?>
									</p>
                                    <span class="dialog"></span>
                                    <br>
							
								</div><!--[end]một bình luận-->
</div>
<? 
	}
	$lenght = count($arrBinhLuan);
	$rowlast = $arrBinhLuan[$lenght-1]; 
?>
<? if($tongbinhluan > 10){ ?>
<a id=<?=$rowlast['MaBinhLuan']?> class="more">xem thêm</a>
<? } ?>